import java.util.ArrayList;
import java.util.List;
/*递归*/
public class Solution {
    /*中序遍历*/
    public List<Integer> inorderTraversal(TreeNode root) {
        List<Integer> list = new ArrayList<>();
        if (root != null) {
            list.addAll(inorderTraversal(root.left));
            list.add(root.val);
            list.addAll(inorderTraversal(root.right));
        }
        return list;
    }
/*前序和后序略*/
}


class TreeNode {
    int val;
    TreeNode left;
    TreeNode right;
    TreeNode() {}
    TreeNode(int val) { this.val = val; }
    TreeNode(int val, TreeNode left, TreeNode right) {
        this.val = val;
        this.left = left;
        this.right = right;
    }
}

// 希望你开心点，一起加油！
/*
     _--_  _--_
    -    \/    -
     -        -
       -    -
         -

        _
       \   \
         \    \
         |     |
        /    /
       ... `

*/